#pragma once

class CFibonacci
{
public:

	static int ExecFibonacci(int num)
	{
		int* arr = new int[num + 1]{0};
		return Recuese(arr, num);
	}

	static int Recuese(int arr[], int num)
	{
		if (0 == num)
		{
			return 0;
		}
		if (1 == num)
		{
			return 1;
		}
		if (arr[num] != 0)
		{
			return arr[num];
		}
		arr[num] = Recuese(arr, num - 2) + Recuese(arr, num - 1);
	}
};
